﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace PPM.Blog.Domain.Core
{
    [Table("T_User", Schema = "dbo")]
    public class User
    {
        [Key]
        public int Id { get; set; }

        [Required]
        [StringLength(10)]
        public string Account { get; set; }

        [StringLength(10)]
        public string NickName { get; set; }

        [Required]
        [StringLength(32)]
        public string Password { get; set; }

        [StringLength(13)]
        public string Mobile { get; set; }

        public string Email { get; set; }

        [Phone]
        public string Phone { get; set; }


        public int State { get; set; }

      
        public int CreatorId { get; set; }

        public DateTime CreateTime { get; set; }

        public int?  LastModifierId { get; set; }

        public DateTime? LastModifyTime { get; set; }

        [ForeignKey("CreatorId")]
        public virtual User Creator { get; set; }

        [ForeignKey("LastModifierId")]
        public virtual User LastModifier { get; set; }

        [InverseProperty("Creator")]
        public virtual ICollection<User> UsersCreated { get; set; }
        [InverseProperty("LastModifier")]
        public virtual ICollection<User> UsersModified { get; set; }
    }

}